<?php

namespace app\admin\model;

use think\Model;

class User extends Model
{
    protected $pk = 'user_id';
    //时间字段显示格式
    protected $dateFormat = 'Y-m-d H:i:s';
    //开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'timestamp';
    //数据输出显示属性
    public static $showField = ['user_id', 'username', 'password', 'create_time', 'disabled'];
    //用户-角色表
    public function roles()
    {
        return $this->belongsToMany(Role::class, UserRole::class);
    }

}